<template>
    <div>

        <a-modal v-model:visible="show" title="HBK收款单信息" width="1700px" @ok="handleOk" @cancel="handleCancel">
            <div style="display: flex;margin-bottom:10px;">
                <a-button @click="jumpHBK">创建</a-button>
                <a-button @click="refreshData">刷新</a-button>
            </div>
            <a-form-model ref="qualityHbkList">
                <a-table :columns="columns" :data-source="records" >
                    
                </a-table>
            </a-form-model>
        </a-modal>
    </div>
</template>

<script>

import { getAction, postAction } from '@/api/manage'

export default {
    props:{
        qualityId:{
            type: String,
            default: null,
        },
        show:{
            type: Boolean,
            default: false
        },
        fineMethod:{
            type:String,
            default:null
        }
    },

    mounted() {
        
    },

    data() {
      return {
        urls:{
            jumpToHBK:'',
            relateData:'',
        },
        columns:[
        {
                title: '序号',
                dataIndex: 'sortIndex',
                scopedSlots: { customRender: 'sortIndexRender' },
                width: '80px',
                align: 'center',
            },
            {
                title: '收款单名称',
                dataIndex: 'hbkName',
                key: 'hbkName',
                scopedSlots: { customRender: 'penaltyCodeRender' },
            },
            {
                title: '收款金额(元)',
                dataIndex: 'hbkAmount',
                key: 'hbkAmount',
                scopedSlots: { customRender: 'penaltyNameRender' },
            },
            {
                title: '采购订单号',
                dataIndex: 'busKey',
                key: 'busKey',
                scopedSlots: { customRender: 'penaltyPatternRender' },
            },
            {
                title: '合同编号',
                dataIndex: 'contractNo',
                key: 'contractNo',
                scopedSlots: { customRender: 'penaltyUnitRender' },
            },
            {
                title: '合同名称',
                dataIndex: 'contractName',
                key: 'contractName',
                scopedSlots: { customRender: 'penaltyPriceMinRender' },
            },
            {
                title: '申请人',
                dataIndex: 'applyUser',
                key: 'applyUser',
                scopedSlots: { customRender: 'penaltyPriceMinRender' },
            },
            {
                title: '申请时间',
                dataIndex: 'applyTime',
                key: 'applyTime',
                scopedSlots: { customRender: 'penaltyPriceMinRender' },
            },
        ],
        records:[],
      }
    },
    methods:{
        jumpHBK(){
            console.log('跳转到HBK')
            if(this.fineMethod != '1'){
                console.log('扣罚方式不是财务扣罚条款,无法进行创建');
                return
            }

            if(!this.records && this.records.length > 0){
                console.log('该质量通知单已经与HBK收款单进行关联')
                return
            }
            console.log('可以打开跳转信息')
        },
        refreshData(){
            console.log('刷新')
            this.fetchList()
        },
        fetchList(){
            console.log('加载数据')
        },
        handleOk(){
            console.log('确定')
            this.$emit('close', [])
        },
        handleCancel(){
            console.log('取消')
            this.$emit('close', [])
        }
    },
    watch: {
        show(newV, oldV) {
            console.log('newV:',newV)
            console.log('oldV:',oldV)
            console.log('this.qualityId',this.qualityId)
            if(newV){
                //this.fetchList()
            }
            if(oldV){
                console.log('关闭')
            }
        
        },
    }
}

</script>

<style scoped>


</style>